<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.lmpop.trade.ti_member.*"%>
<%@ page import="com.lmpop.frame.dao.MenuInfo"%>
<%@ page import="com.lmpop.frame.pojo.Menuinfo"%>
	<%
	response.setHeader("Pragma","No-cache");
	response.setHeader("Cache-Control","no-cache");
	response.setDateHeader("Expires", 0); 
	 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
		<META HTTP-EQUIV="Expires" CONTENT="0"> 
		<title>shop-个人管理中心</title>
		<link rel="stylesheet" rev="stylesheet" href="/templets/html/shop/css/Home.css" type="text/css" />
		<link href="/templets/html/shop/css/style.css" rel="stylesheet"
			type="text/css" />
				<script type='text/javascript' src='/dwr/engine.js'></script>
		<script type='text/javascript' src='/dwr/util.js'></script>
		<script type='text/javascript' src='/dwr/interface/Ti_subscribeInfo.js'></script> 
		<script type='text/javascript' src='/templets/html/shop/js/_shop.js'></script>
		<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
		<SCRIPT src="/templets/html/shop/js/taobao.js"></SCRIPT>
		<SCRIPT src="/templets/html/shop/js/nav_style_num.js"></SCRIPT>
		<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="/js/jquery-1.4.4.js"></script>
		<script type="text/javascript" src="/templets/html/shop/js/menu_qiehuan.js"></script>
		<%
	
	Map menuinfos = new Hashtable();
	menuinfos.put("subsys_code", "B2B");
	menuinfos.put("menu_class", "1");
	String up_menu_id = "";
	if (request.getParameter("menu_id") != null && !request.getParameter("menu_id").equals("")) {
		up_menu_id = request.getParameter("menu_id");
		menuinfos.put("up_menu_id", up_menu_id);
	}

	String role_code = "";
	if (session.getAttribute("session_role_code") != null && !((String) session.getAttribute("session_role_code")).equals("")) {
		role_code = (String) session.getAttribute("session_role_code");
		menuinfos.put("role_code", role_code);
	}
	String user_type = "";
	if (session.getAttribute("session_user_type") != null && !((String) session.getAttribute("session_user_type")).equals("")) {
		user_type = (String) session.getAttribute("session_user_type");
	}

	String user_id = "", user_name = "";
	if (session.getAttribute("session_user_id") != null) {
		user_id = session.getAttribute("session_user_id").toString();
	}
	String cust_id = "";
	if (session.getAttribute("session_cust_id") != null) {
		cust_id = session.getAttribute("session_cust_id").toString();
	}
	if (session.getAttribute("session_user_name") != null) {
		user_name = session.getAttribute("session_user_name").toString();
	}
		
	String cust_type = "";
	if (session.getAttribute("session_cust_type") != null && !((String) session.getAttribute("session_cust_type")).equals("")) {
		cust_type = (String) session.getAttribute("session_cust_type");
	}
	
	Ti_memberInfo memberInfo = new Ti_memberInfo();

	String cust_class = memberInfo.getCustClassByPk(cust_id);
	if (cust_class != null && !cust_class.equals("")) {
		menuinfos.put("cust_class", cust_class);
	}
	
	MenuInfo menuInfo = new MenuInfo();
	if (up_menu_id.equals("")) {
		String first_menu_id = menuInfo.getOneLevelFirstMenu(menuinfos,user_type);
	}

	List menuList = null;
	if (user_type.equals("2") || user_type.equals("0")) {
		menuList = menuInfo.getMenuinfoByCustClass(menuinfos);
	} else if (user_type.equals("1") || user_type.equals("3")) {
		menuList = menuInfo.getMenuinfoByRole(menuinfos);
	}
	
	String menuinit=request.getParameter("menuinit");
	if(menuinit == null) menuinit = "";
	
	
%>
		<script type="text/javascript">
		function orderInit(){
		
			if("<%=menuinit%>"=="1"){
				changeIFrameInfos('/program/member/order/index.jsp');
				//初始化菜单导航
				$("h1").each(function(index){
					if($(this).html().indexOf("交易") > 0){
						$("span[class='no']").each(function(location){
							if((index-1) == location){
								$(this).removeClass("no");
							}
						});
					}
				});
			}
		}
		</script>
		<%
	if (cust_type.equals("0")){	
	%>
	<script LANGUAGE="JavaScript">
    <!--
    window.location="/company_member.html";
    // -->
    </script>
	<%
	}
%>
	</head>
	<%
	if(menuList==null&&!cust_id.equals("100000000000000")){%>
		<script>
			window.location.href="/shop_member.html";
		</script>
	<%}
 %>
	<body onload="orderInit()">
		<script> 
		  document.write("<s" + "cript type='text/javascript' src='/templets/html/shop/top.jsp?" + Math.random() + "'></scr" + "ipt>");
		  TB.Header.init(); 
		</script>
		<div id="mainbox">
			<div class="main_left">
			<!--	<h3 onclick="javascript:window.location.href='/shop_member.html';" style="cursor:pointer;">个人中心</h3>-->
				<div id="menu">
				<%
				if (menuList != null && menuList.size() > 0) {
					Hashtable mMap = new Hashtable();
					for (int i = 0; i < menuList.size(); i++) {
						mMap = (Hashtable) menuList.get(i);
						String menu_id = "", menu_name = "";
						if (mMap.get("menu_id") != null)
							menu_id = mMap.get("menu_id").toString();
						if (mMap.get("menu_name") != null)
							menu_name = mMap.get("menu_name").toString();
						List children = new ArrayList();
						if (!menu_id.equals("")) {
							Map temMap = new Hashtable();
							temMap.put("up_menu_id", menu_id); //���⼶Ŀ¼��Ϊ�ϼ�Ŀ¼
							temMap.put("cust_class", cust_class); //

							children = menuInfo.getMenuinfoByUpIdClass(temMap);
						}
				%>
					<h1 onClick="javascript:ShowMenu(this,<%=i%>)"><%=menu_name%></h1>
					<span >
					<%
					if (children != null && children.size() > 0) {
					Hashtable twoMenuMap = new Hashtable();
					for (int j = 0; j < children.size(); j++) {
						twoMenuMap = (Hashtable) children.get(j);
						String c_name = "", c_id = "";
						if (twoMenuMap.get("menu_id") != null)
							c_id = twoMenuMap.get("menu_id").toString();
						if (twoMenuMap.get("menu_name") != null)
							c_name = twoMenuMap.get("menu_name").toString();
	
						List children3 = new ArrayList();
						if (!c_id.equals("")) {
							Map temMap3 = new Hashtable();
							temMap3.put("up_menu_id", c_id); //���⼶Ŀ¼��Ϊ�ϼ�Ŀ¼
							temMap3.put("cust_class", cust_class); //
	
							children3 = menuInfo.getMenuinfoByUpIdClass(temMap3);
							if (children3 != null && children3.size() > 0) {
								Hashtable twoMenuMap3 = new Hashtable();
								for (int k = 0; k < children3.size(); k++) {
									twoMenuMap3 = (Hashtable) children3.get(k);
									String c_name3 = "", c_id3 = "";
									if (twoMenuMap3.get("menu_id") != null) {
										c_id3 = twoMenuMap3.get("menu_id").toString();
									}
									if (twoMenuMap3.get("menu_name") != null) {
										c_name3 = twoMenuMap3.get("menu_name").toString();
									}
									String module_path = menuInfo.getModuleFile(c_id3);
									module_path = module_path.replace("WebRoot/", "") + "?menu_id=" + c_id3;
 						%>
						<h2><a href="javascript:changeIFrameInfos('<%=module_path%>');"> <%=c_name%></a></h2> 
					
						<%
 								}
 						} else {
 							String module_path = menuInfo.getModuleFile(c_id);
 							module_path = module_path.replace("WebRoot/", "") + "?menu_id=" + c_id;
 						%>
						<h2><a href="javascript:changeIFrameInfos('<%=module_path%>');"><%=c_name%></a></h2>
						<%}
							}
						}
						}
						%>
						</span>
				<%
					}
				}
				%>
				</div>
			</div>
			<div class="main_right">

			<iframe name="contentFrame" src="/program/member/index/shop/welcome.jsp" border=0 marginWidth=0 frameSpacing=0 marginHeight=0 frameBorder=0 noResize  scrolling="no" width="780" height=100% vspale="0" id="contentFrame"></iframe></div>
		</div>

		<!--footer begin-->
<jsp:include page="/templets/html/shop/footer.jsp"/>
		<!--footer over-->	
		
	</body>
</html>